/**
 * 与原生交互的JS桥接接口
 */

/**
 *
 * @param {是否显示原生的AppBar} isShow
 */
function showMeVC(isShow, callBack) {
  let show = "1"; //默认1显示， 0隐藏
  if (!isShow) {
    show = "0";
  }
  if (window.$bridge) {
    window.$bridge.callHandler(
      "showMeVC",
      JSON.stringify({ isShow: show }),
      (res) => {
        console.log("showMeVC = " + JSON.stringify(res));
        if (callBack && typeof callBack === "function") {
          callBack(res);
        }
      }
    );
  } else {
    console.error("call showMeVC error, no bridge");
  }
}

var JSBridge = {
  showMeVC,
};

export default JSBridge;
